package org.csmz.exption01;

public class Example24 {
    public static void saveAge(int age) throws AgeIllegalException{
        if(age>0 && age<150){
            System.out.println("年龄保存成功");
        }else{
            throw new AgeIllegalException("年龄输入有误");
        }
    }
    public static void main(String[] args){
        try{
            saveAge(225);
        }catch (AgeIllegalException e){
            System.out.println(e.getMessage);
        }
    }
}
